<html>
<head><meta charset="utf-8"><title>Does cargo read `init.defaultBranch` from gitconfig · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html">Does cargo read `init.defaultBranch` from gitconfig</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205454051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205454051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205454051">(Jul 30 2020 at 08:37)</a>:</h4>
<p>Since git 2.28, git introduces <code>init.defaultBranch</code> to specify the new repo default branch name.<br>
Does libgit2 (which cargo uses) support this?</p>



<a name="205454134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205454134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205454134">(Jul 30 2020 at 08:38)</a>:</h4>
<p>I built and checked cargo on master commit, seems like cargo doesn't support this yet.</p>



<a name="205475765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205475765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205475765">(Jul 30 2020 at 13:08)</a>:</h4>
<p>I believe it depends what you mean by support. But there have been issues working on it recently. for example <br>
<a href="https://github.com/rust-lang/cargo/pull/8522">https://github.com/rust-lang/cargo/pull/8522</a></p>



<a name="205475989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205475989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205475989">(Jul 30 2020 at 13:10)</a>:</h4>
<p>When using <code>cargo new</code>, a new git repo is created. It seems that cargo doesn't yet respect the <code>init.defaultBranch</code> git config used to determine the name of the default branch when creating a new git repo.</p>



<a name="205476935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205476935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205476935">(Jul 30 2020 at 13:17)</a>:</h4>
<p>yeah, that's it. My English is not good really.</p>



<a name="205477058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205477058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205477058">(Jul 30 2020 at 13:18)</a>:</h4>
<p>I feel like I have seen a bug report about that. There is a flag that teles cargo to use cli git instead of libgit2, if it works with that flag then we are just waiting on libgit2 support.</p>



<a name="205558832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205558832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205558832">(Jul 31 2020 at 05:24)</a>:</h4>
<p><span class="user-mention" data-user-id="120179">@Eh2406</span> Yeah, I think someone just needs to implement it in libgit2.</p>



<a name="205594763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Does%20cargo%20read%20%60init.defaultBranch%60%20from%20gitconfig/near/205594763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Does.20cargo.20read.20.60init.2EdefaultBranch.60.20from.20gitconfig.html#205594763">(Jul 31 2020 at 14:13)</a>:</h4>
<p>There is already a PR open for that.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>